package com.my.zl.console.controller.autocode;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.my.zl.common.dto.ReqDTO;
import com.my.zl.common.dto.ResDTO;
import com.my.zl.common.dto.advancedQuery.PageQueryDTO;
import com.my.zl.console.common.aop.LogAnnotation;
import com.my.zl.console.controller.base.BaseController;
import com.my.zl.console.dto.autocode.dictDtl.ReqDictDtlAddDTO;
import com.my.zl.console.dto.autocode.dictDtl.ReqDictDtlDelDTO;
import com.my.zl.console.dto.autocode.dictDtl.ReqDictDtlDetailDTO;
import com.my.zl.console.dto.autocode.dictDtl.ReqDictDtlEditDTO;
import com.my.zl.console.dto.autocode.dictDtl.ReqDictDtlQueryDTO;
import com.my.zl.console.dto.autocode.dictDtl.ReqDictDtlStateDTO;
import com.my.zl.console.dto.autocode.dictDtl.ResDictDtlAddDTO;
import com.my.zl.console.dto.autocode.dictDtl.ResDictDtlDelDTO;
import com.my.zl.console.dto.autocode.dictDtl.ResDictDtlDetailDTO;
import com.my.zl.console.dto.autocode.dictDtl.ResDictDtlEditDTO;
import com.my.zl.console.dto.autocode.dictDtl.ResDictDtlQueryDTO;
import com.my.zl.console.dto.autocode.dictDtl.ResDictDtlStateDTO;
import com.my.zl.console.service.autocode.IDictDtlService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 字典明细
 * @author ZL
 */
@Api(value="字典明细",tags ="字典明细")
@RestController
@RequestMapping("/api/autocode/dictDtl")
public class DictDtlController extends BaseController {

    @Autowired
    private IDictDtlService dictDtlService;
    
    /**
     * 查询
     */
    @ApiOperation(value="字典明细-查询")
    @RequestMapping(value="/list", method = RequestMethod.GET)
    public ResDTO<ResDictDtlQueryDTO> listDictDtl(ReqDictDtlQueryDTO reqInfo,PageQueryDTO page) throws Exception{
        ResDictDtlQueryDTO data = dictDtlService.queryDictDtlList(reqInfo,page);
        return successDATA(data);
    }
    
   /**
     * 详情
     */
    @ApiOperation(value="字典明细-详情")
    @RequestMapping(value="/detail", method = RequestMethod.GET)
    public ResDTO<ResDictDtlDetailDTO> detailDictDtl(ReqDictDtlDetailDTO reqInfo) throws Exception{
        ResDictDtlDetailDTO data = dictDtlService.queryDictDtlDetail(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 新增
     */
    @ApiOperation(value="字典明细-新增")
    @RequestMapping(value="/add", method = RequestMethod.POST)
    public ResDTO<ResDictDtlAddDTO> addDictDtl(@RequestBody ReqDTO<ReqDictDtlAddDTO> reqInfo) throws Exception{
        ResDictDtlAddDTO data = dictDtlService.insertDictDtlInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 编辑
     */
    @ApiOperation(value="字典明细-编辑")
    @RequestMapping(value="/edit", method = RequestMethod.POST)
    public ResDTO<ResDictDtlEditDTO> editDictDtl(@RequestBody ReqDTO<ReqDictDtlEditDTO> reqInfo) throws Exception{
        ResDictDtlEditDTO data = dictDtlService.updateDictDtlInfo(reqInfo);
        return successDATA(data);
    }
    
    /**
     * 删除
     */
    @ApiOperation(value="字典明细-删除")
    @RequestMapping(value="/del", method = RequestMethod.POST)
    public ResDTO<ResDictDtlDelDTO> delDictDtl(@RequestBody ReqDTO<ReqDictDtlDelDTO> reqInfo) throws Exception{
        ResDictDtlDelDTO data = dictDtlService.deleteDictDtlInfo(reqInfo);
        return successDATA(data); 
    }
    
    /**
     * 状态更新
     */
    @ApiOperation(value="字典明细-状态更新")
    @RequestMapping(value="/state", method = RequestMethod.POST)
    public ResDTO<ResDictDtlStateDTO> stateDictDtl(@RequestBody ReqDTO<ReqDictDtlStateDTO> reqInfo) throws Exception{
        ResDictDtlStateDTO data = dictDtlService.updateDictDtlState(reqInfo);
        return successDATA(data); 
    }
    
    
}